package vip.liux.backend.application.service.product;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import vip.liux.contracts.shared.enums.product.DeductStockType;
import vip.liux.contracts.shared.enums.product.ShelfState;
import vip.liux.contracts.shared.value.SpecDetail;
import vip.liux.contracts.shared.value.Specs;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;


@Getter
@Setter
public class CreateProductDto implements Serializable {

    @NotBlank
    private String catNo;

    @NotBlank
    private String brandNo;

    @NotBlank
    private String productName;

    private String remark;

    @NotNull
    @Size(min = 1, max = 10)
    private List<String> mainImages;

    @NotNull
    @Size(min = 1, max = 10)
    private List<String> detailImages;

    /**
     * 商品规格组
     */
    private List<Specs> specs;

    /**
     * sku详情
     */
    private List<CreateProductDetailDto> details;

    /**
     * 库存计算方式
     * 0: 下单减库存，1：付款减库存
     */
    private DeductStockType deductStockType;

    /**
     * 限购
     */
    private boolean restrict;

    /**
     * 限购总数
     * 0: 不限制
     */
    private int restrictTotal;

    /**
     * 限购单次购买数量
     * 0: 不限制
     */
    private int restrictSingle;

    /**
     * 商品详情
     */
    private String desc;

    private String sellingPoint;

    /**
     * 初始销量
     */
    private int salesInitial;

    @Getter
    @Setter
    @Builder
    public static class CreateProductDetailDto implements Serializable {
        private String barCode;

        @NotNull
        private BigDecimal marketPrice;

        @NotNull
        private BigDecimal salePrice;

        @NotNull
        private Integer stockTotal;

        private String image;

        private ShelfState shelfState;

        private List<SpecDetail> specDataList;

        private String sku;
    }
}